#[doc = "Register `LSADC_CTRL1` reader"]
pub struct R(crate::R<LSADC_CTRL1_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<LSADC_CTRL1_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<LSADC_CTRL1_SPEC>> for R {
    fn from(reader: crate::R<LSADC_CTRL1_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `LSADC_CTRL1` writer"]
pub struct W(crate::W<LSADC_CTRL1_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<LSADC_CTRL1_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<LSADC_CTRL1_SPEC>> for W {
    fn from(writer: crate::W<LSADC_CTRL1_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "FIFO threshold setting.\n\nValue on reset: 2"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum RXINTSIZE_A {
    #[doc = "0: 127"]
    SIZE_127 = 0,
    #[doc = "1: 124"]
    SIZE_124 = 1,
    #[doc = "2: 64"]
    SIZE_64 = 2,
    #[doc = "3: 32"]
    SIZE_32 = 3,
    #[doc = "4: 16"]
    SIZE_16 = 4,
    #[doc = "5: 8"]
    SIZE_8 = 5,
    #[doc = "6: 4"]
    SIZE_4 = 6,
    #[doc = "7: 1"]
    SIZE_1 = 7,
}
impl From<RXINTSIZE_A> for u8 {
    #[inline(always)]
    fn from(variant: RXINTSIZE_A) -> Self {
        variant as _
    }
}
#[doc = "Field `rxintsize` reader - FIFO threshold setting."]
pub struct RXINTSIZE_R(crate::FieldReader<u8, RXINTSIZE_A>);
impl RXINTSIZE_R {
    pub(crate) fn new(bits: u8) -> Self {
        RXINTSIZE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RXINTSIZE_A {
        match self.bits {
            0 => RXINTSIZE_A::SIZE_127,
            1 => RXINTSIZE_A::SIZE_124,
            2 => RXINTSIZE_A::SIZE_64,
            3 => RXINTSIZE_A::SIZE_32,
            4 => RXINTSIZE_A::SIZE_16,
            5 => RXINTSIZE_A::SIZE_8,
            6 => RXINTSIZE_A::SIZE_4,
            7 => RXINTSIZE_A::SIZE_1,
            _ => unreachable!(),
        }
    }
    #[doc = "Checks if the value of the field is `SIZE_127`"]
    #[inline(always)]
    pub fn is_size_127(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_127
    }
    #[doc = "Checks if the value of the field is `SIZE_124`"]
    #[inline(always)]
    pub fn is_size_124(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_124
    }
    #[doc = "Checks if the value of the field is `SIZE_64`"]
    #[inline(always)]
    pub fn is_size_64(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_64
    }
    #[doc = "Checks if the value of the field is `SIZE_32`"]
    #[inline(always)]
    pub fn is_size_32(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_32
    }
    #[doc = "Checks if the value of the field is `SIZE_16`"]
    #[inline(always)]
    pub fn is_size_16(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_16
    }
    #[doc = "Checks if the value of the field is `SIZE_8`"]
    #[inline(always)]
    pub fn is_size_8(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_8
    }
    #[doc = "Checks if the value of the field is `SIZE_4`"]
    #[inline(always)]
    pub fn is_size_4(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_4
    }
    #[doc = "Checks if the value of the field is `SIZE_1`"]
    #[inline(always)]
    pub fn is_size_1(&self) -> bool {
        **self == RXINTSIZE_A::SIZE_1
    }
}
impl core::ops::Deref for RXINTSIZE_R {
    type Target = crate::FieldReader<u8, RXINTSIZE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rxintsize` writer - FIFO threshold setting."]
pub struct RXINTSIZE_W<'a> {
    w: &'a mut W,
}
impl<'a> RXINTSIZE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RXINTSIZE_A) -> &'a mut W {
        self.bits(variant.into())
    }
    #[doc = "127"]
    #[inline(always)]
    pub fn size_127(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_127)
    }
    #[doc = "124"]
    #[inline(always)]
    pub fn size_124(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_124)
    }
    #[doc = "64"]
    #[inline(always)]
    pub fn size_64(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_64)
    }
    #[doc = "32"]
    #[inline(always)]
    pub fn size_32(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_32)
    }
    #[doc = "16"]
    #[inline(always)]
    pub fn size_16(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_16)
    }
    #[doc = "8"]
    #[inline(always)]
    pub fn size_8(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_8)
    }
    #[doc = "4"]
    #[inline(always)]
    pub fn size_4(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_4)
    }
    #[doc = "1"]
    #[inline(always)]
    pub fn size_1(self) -> &'a mut W {
        self.variant(RXINTSIZE_A::SIZE_1)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:2 - FIFO threshold setting."]
    #[inline(always)]
    pub fn rxintsize(&self) -> RXINTSIZE_R {
        RXINTSIZE_R::new((self.bits & 0x07) as u8)
    }
}
impl W {
    #[doc = "Bits 0:2 - FIFO threshold setting."]
    #[inline(always)]
    pub fn rxintsize(&mut self) -> RXINTSIZE_W {
        RXINTSIZE_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "LSADC_CTRL1 is the ADC FIFO configuration register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lsadc_ctrl1](index.html) module"]
pub struct LSADC_CTRL1_SPEC;
impl crate::RegisterSpec for LSADC_CTRL1_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [lsadc_ctrl1::R](R) reader structure"]
impl crate::Readable for LSADC_CTRL1_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [lsadc_ctrl1::W](W) writer structure"]
impl crate::Writable for LSADC_CTRL1_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets LSADC_CTRL1 to value 0x02"]
impl crate::Resettable for LSADC_CTRL1_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0x02
    }
}
